import Vue from "vue";
import App from './App.vue'
import moment from "moment"
//import LjButton from "./components/LjButton.vue"
// Vue.component ("LjButton",LjButton)
//Vue.component (LjButton.name,LjButton)
import router from "./router"
Vue.config.productionTip = false;
Vue.directive('aaa',  { 
    inserted(el){ 
        el.style.color="red"
    }
})
Vue.directive('bbb',  { 
    inserted(el, binding) { 
        console.log(binding)
        el.style.backgroundColor = binding.value
    }
})
Vue.directive('ccc', {
    inserted(el,binding) { 
        el.style.width=binding.value
    }
})
Vue.directive('ddd', {
    update(el,binding) { 
        el.style.color = binding.value.trim().length >= 4 && binding.value.trim().length <= 7
            ? 'green'
            :'red'
    }
})
Vue.directive('left', {
    inserted(el,binding) { 
        el.style.transform=`translateX(${binding.value}px)`
    }
})
Vue.directive('active', {
    inserted(el, binding) { 
        const list = el.children
        for (let i = 0; i < list.length; i++) { 
            list[i].onclick = function () { 
                for (let j = 0; j < list.length; j++) { 
                    list[j].style.backgroundColor=''
                }
                this.style.backgroundColor='lightpink'
            }
        }
        list[binding.value].onclick()
    }
})
Vue.directive('focus', {
    inserted(el) { 
        el.focus()
    }
})
// 全局过滤器
Vue.filter('dataformat',function(value){
    return moment(value).format("YYYY-MM-DD HH:mm")
  })
new Vue({
   /*  render(creatElement) { 
        return creatElement("h1",['hello word123'])
    } */
    render: (h) => h(App),
    router,
}).$mount("#app");
